<?php 
$cid = $this->cid;
?>
<?php include_once 'inc_modules_path.php'; ?>

<h3>  <i class="fa fa-pencil"></i>  <?php echo $title; ?></h3>

<?php include_once 'inc_form_errors.php'; ?>

<div class="boxed">
	<?php echo form_open(site_urlc($this->class.'/edit'), array('class' => 'form-horizontal', 'id' => 'frm-edit')); ?>

		<input class="hide" type="text" id="p-title" name="title" value="<?php echo set_value('title',$seo['title']) ?>">
		<input class="hide" type="text" id="p-title_seo" name="title_seo" value="<?php echo set_value('title_seo',$seo['title_seo']) ?>">
		<input class="hide" type="text" id="p-tags" name="tags" value="<?php echo set_value('tags',$seo['tags']) ?>">
		<textarea class="hide" id='p-intro' name="intro" rows='8' class='span4'><?php echo set_value('intro',$seo['intro']) ?></textarea>

		<div class="boxed-inner seamless">

						<?php if($cid == 21):?>
						<div class="control-group">
                <label for="title" class="control-label">产品名称：</label>
                <div class="controls">
                    <input type="text" name="title4" id="title4" value="<?php echo set_value('title4',$it['title4']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <div class="control-group">
                <label for="title" class="control-label">产品系列：</label>
                <div class="controls">
                    <input type="text" name="title5" id="title5" value="<?php echo set_value('title5',$it['title5']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
						<div class="control-group">
                <label for="title" class="control-label">标题1：</label>
                <div class="controls">
                    <input type="text" name="title1" id="title1" value="<?php echo set_value('title1',$it['title1']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="content1">介绍1：</label>
                <div class="controls">
                    <textarea type="text" id="content1" name="content1" rows="3" cols="1"><?php echo set_value('content1',$it['content1']);?></textarea>
                </div>
            </div>
            <div class="control-group">
                <label for="title" class="control-label">标题2：</label>
                <div class="controls">
                    <input type="text" name="title2" id="title2" value="<?php echo set_value('title2',$it['title2']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="content2">介绍2：</label>
                <div class="controls">
                    <textarea type="text" id="content2" name="content2" rows="3" cols="1"><?php echo set_value('content2',$it['content2']);?></textarea>
                </div>
            </div>
            <div class="control-group">
                <label for="title" class="control-label">标题3：</label>
                <div class="controls">
                    <input type="text" name="title3" id="title3" value="<?php echo set_value('title3',$it['title3']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="content3">介绍3：</label>
                <div class="controls">
                    <textarea type="text" id="content3" name="content3" rows="3" cols="1"><?php echo set_value('content3',$it['content3']);?></textarea>
                </div>
            </div>
            
            <?php endif;?>
		
						<?php if($cid == 12):?>
						<div class="control-group">
                <label for="title" class="control-label">链接：</label>
                <div class="controls">
                    <input type="text" name="link" id="link" value="<?php echo set_value('link',$it['link']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <?php endif;?>
			<?php if($cid == 3):?>
						<div class="control-group">
                <label class="control-label" for="a">公司地址：</label>
                <div class="controls">
                    <textarea type="text" id="dz" name="dz" rows="3" cols="1"><?php echo set_value('dz',$it['dz']);?></textarea>
                </div>
            </div>
            <div class="control-group">
                <label for="title" class="control-label">电话：</label>
                <div class="controls">
                    <input type="text" name="tel" id="tel" value="<?php echo set_value('tel',$it['tel']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <div class="control-group">
                <label for="title" class="control-label">传真：</label>
                <div class="controls">
                    <input type="text" name="fax" id="fax" value="<?php echo set_value('fax',$it['fax']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
            <div class="control-group">
                <label for="title" class="control-label">E-mail：</label>
                <div class="controls">
                    <input type="text" name="email" id="email" value="<?php echo set_value('email',$it['email']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
             <div class="control-group">
                <label for="title" class="control-label">QQ号码：</label>
                <div class="controls">
                    <input type="text" name="qqq" id="qqq" value="<?php echo set_value('qqq',$it['qqq']); ?>">
                    <span class="help-inline"></span>
                </div>
            </div>
			<?php else:?>
			<?php if($cid == 12 ||$cid == 17 ||$cid == 18 ||$cid == 19 ||$cid == 20||$cid == 21):?><?php else:?>
			<div class="control-group uefull">
				<textarea id="editor_id" name="content" > <?php echo set_value('content',$it['content']); ?></textarea>
				<!-- <span class="help-inline"></span> -->
			</div>
			<?php endif;?>
			<?php endif;?>

			<?php if($cid == 9 ||$cid == 11 ||$cid == 12 ||$cid == 15||$cid == 21):?><?php else:?>
			<!-- 图片上传 -->
			<div class="control-group">
				<label for="img" class="control-label">
				<?php if($cid == 3):?>
				二维码：
				<?php else:?>
				图片：
				<?php endif;?>
				</label>
				<div class="controls">
					<div class="btn-group">
						<span class="btn btn-success">
							<i class="fa fa-upload"></i>
							<span>
							<?php if($cid == 17 ||$cid == 18 ||$cid == 19 ||$cid == 20):?>
							[推荐上传尺寸1680*400或同比例图片]
							<?php endif;?>
							<?php if($cid == 2):?>
							[推荐上传尺寸450*500或同比例图片]
							<?php endif;?>
							<?php if($cid == 3):?>
							[推荐上传尺寸82*82或同比例图片]
							<?php endif;?>
							</span>
							<input class="fileupload" type="file" accept="" data-for="photo" multiple="multiple">
						</span>
						<input type="hidden" name="photo" class="form-upload" data-more="1" value="<?php echo $it['photo'] ?>">
						<input type="hidden" name="thumb" class="form-upload-thumb" value="<?php echo $it['thumb'] ?>">
					</div>
				</div>
			</div>
			<div id="js-photo-show" class="js-img-list-f">
				<!-- 模板 #tpl-img-list -->
			</div>
			<div class="clear"></div>
			<?php endif;?>

		</div>

		<div class="boxed-footer">
			<input type="hidden" name="cid" value="<?php echo $this->cid ?>">
			<input type="hidden" name="id" value="<?php echo $it['id']?>">
			<input type="submit" value="<?php echo lang('submit') ?>" class="btn btn-primary">
			<input type="reset" value="<?php echo lang('reset') ?>" class="btn btn-danger">
		</div>
	</form>
</div>

<?php include_once 'inc_ui_media.php'; ?>

<script type="text/javascript">
require(['jquery','adminer/js/ui','adminer/js/media'],function($,ui,media){
	ui.editor_create('editor_id');
	var page_photos = <?php echo json_encode(list_upload($it['photo'])) ?>;
	media.init();
	media.show(page_photos,'photo');
	media.sort('photo');
	$("#js-photo-show" ).sortable().disableSelection();
});
</script>
<?php //echo static_file('adminer/js/page.js'); ?>
